﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>诊室门口</title>
    <link href="/static/web/door_vertical/css.css" rel="stylesheet" />
    <script src="/static/web/door_vertical/jquery.min.js"></script>
</head>
<script>
    function DrawImage(ImgD, iwidth, iheight) {
        //参数(图片,允许的宽度,允许的高度)
        var image = new Image();
        image.src = ImgD.src;
        if (image.width > 0 && image.height > 0) {
            if (image.width / image.height >= iwidth / iheight) {
                if (image.width > iwidth) {
                    ImgD.width = iwidth;
                    ImgD.height = (image.height * iwidth) / image.width;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
            } else {
                if (image.height > iheight) {
                    ImgD.height = iheight;
                    ImgD.width = (image.width * iheight) / image.height;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
            }
        }
    }
</script>

<body style="zoom:0.67">
    <div class="main">
        <div class="title">
            <div class="left" id="hsptl_name">亲睦家老年医院</div>
            <!--<div class="span" id="triage_name"></div>-->
            <div class="right">
                <span id="now_time"></span><br />
                <span id="now_date"></span>
            </div>
        </div>
        <div class="info">
            <div class="left">
                <div class="img"><table width="100%"><tr><td align="center" valign="middle"><img src=""  onload="javascript:DrawImage(this,300,300)" id="doc_img" /></td></tr></table></div>
                <div class="d_name" id="doc_name"></div>
                <div class="d_title"><span id="doc_title"></span></div>
            </div>
            <div class="right">
                <div class="zs_name"><span id="room_name"></span></div>
                <div class="d_title">医生简介</div>
                <marquee class="d_desc" id="doc_desc" direction="up"  hspace="10" vspace="10"></marquee>
            </div>

        </div>
        
        <div class="jz">
            <div class="left">正在就诊</div>
            <div class="right" id="jz_name"></div>
        </div>
        <div class="dh">
            <div class="left">等候就诊</div>
            <div class="right" id="dh_list"></div>
        </div>

        <div class="bottom">温馨提示：请保管好您的随身物品,耐心等候！！！</div>
    </div>
    <div class="tips_back" id="tips">
        <div class="tips">
            <span id="tips_zsmc"></span><br />
            请耐心等候
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    
    function ShowTime() {
        try {
            var datetime = window.Callobject.getDateTime();
            var year = datetime.split(' ')[0].split('-')[0].toString() + '年' + datetime.split(' ')[0].split('-')[1].toString() + '月' + datetime.split(' ')

            [0].split('-')[2].toString() + '日';
            var week = "　星期" + "日一二三四五六".charAt(datetime.split(' ')[2].toString().trim().replace('7', '0'));
            var time = datetime.split(' ')[1].toString();
            $("#now_date").html(year + week);
            $("#now_time").html(time.split(':')[0] + ':' + time.split(':')[1]);
        }
        catch (ex) { }
    }
    ShowTime();
    window.setInterval(ShowTime, 1000);
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    //var zoom = getUrlParam("zoom");
    //if (parseFloat(zoom) > 0) {
    //    $(".main").css("zoom", zoom);
    //    //$("#tips").css("zoom", 1.67);
    //}
    var zsmc="未知诊室";
    //var ip = getUrlParam("ip");
    //$("#tips").height(window.screen.availHeight);
    //alert(document.body.scrollWidth);
    var rows = parseInt((window.screen.availHeight - 380) / 110);
    
    function GetInfo() {
        try {
            $.ajax({
                type: "GET",
                async: false,
                url: "/clientdoctor/doctor_room_door?t=" + new Date().getTime(),
                contentType: "application/text;charset=utf-8",
                dataType: "json",
                cache: false,
                success: function (data) {
                    if (data.return_code == "success") {
                        $("#doc_name").html(data.doctorinfo.name);
                        $("#doc_title").html(data.doctorinfo.title);
                        $("#doc_desc").html(data.doctorinfo.description);
                        $("#room_name").html(data.doctorinfo.zsmc);
                        $("#doc_img").attr("src", "/static/web/image/" + data.doctorinfo.login_id + ".jpg");
                        zsmc = data.doctorinfo.zsmc;
                        $("#tips").hide();
                    }
                    else {
                        $.ajax({
                            type: "GET",
                            url: "/clientpager/pager_name?t=" + new Date().getTime(),
                            contentType: "application/text;charset=utf-8",
                            dataType: "json",
                            cache: false,
                            success: function (data) {
                                if (data.return_code == "success")
                                    zsmc = data.zsmc;
                                else
                                    zsmc = "未知";
                            }
                        });
                        $("#tips_zsmc").html(zsmc);
                        $("#tips").show();
                        $("#room_name").html(data.zsmc);
                    }
                },
                error: function () {

                }
            });
        }
        catch (err)
        { }
    }
    function GetList() {
        try {
            $.ajax({
                type: "GET",
                url: "/clientPatientQueue/list_roomdoor?t=" + new Date().getTime(),
                contentType: "application/text;charset=utf-8",
                dataType: "json",
                cache: false,
                success: function (data) {
                    if (data.count > 0) {
                        var h_l = "";
                        $.each(data.list, function (i, item) {

                            $("#dh_list").html("");
                            if (i >= 6)
                                return false;
                            else {
                                h_l += "<span>(" + item.register_id + ")" + item.patient_name + "</span>";
                            }

                        });
                        $("#dh_list").html(h_l);
                    }
                    else {
                        $("#dh_list").html("");
                    }
                },
                error: function () {

                }
            });
        }
        catch (err)
        { }
    }

    function PagerCall() {
        try {
            GetList();
            $.ajax({
                type: "GET",
                url: "/clientPatientQueue/list_roomdoor_jz?t=" + new Date().getTime(),
                contentType: "application/text;charset=utf-8",
                dataType: "json",
                cache: false,
                success: function (data) {
                    if (data.return_code == "success") {
                        $("#jz_name").html("(" + data.dqjz.register_id + ")" + data.dqjz.patient_name);
                        if (data.dqjz.caller == "2") {
                            var callText = "<?xml version=\"1.0\" encoding=\"GB18030\"?>"
                                + "<Contents><Content>"
                                + "<Voice Num=\"1\" Speed=\"1000\" digitMode=\"1\">"
                                + "请 " + data.dqjz.register_id + "号" + data.dqjz.patient_name + " 到" + zsmc + "就诊。"
                                + "</Voice>"
                                + "</Content></Contents>";
                            window.Callobject.playVoice(callText)
                        }
                    }
                    else {
                        $("#jz_name").html("");
                    }
                },
                error: function () {

                }
            });
        }
        catch (err)
        { }
    }
   
   
    GetInfo();
    PagerCall();
    
    //window.setInterval(GetList, 2000);
    window.setInterval(PagerCall, 2000);
    window.setInterval(GetInfo, 10000);
    

</script>